package com.shiliao.app.activity.personal.presenter;

import android.text.TextUtils;

import com.shiliao.app.activity.personal.service.ContentRefereeService;
import com.shiliao.app.activity.personal.service.impl.ContentRefereeImpl;
import com.shiliao.app.activity.personal.view.ContentRefereeView;
import com.shiliao.app.utils.YMServerUtil;
import com.yimei.framework.mvp.presenter.IBasePresenter;
import com.yimei.framework.network.ICallBack;
import com.yimei.framework.util.LogUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by yinzhiqiang on 2018/4/19.
 */

public class ContentRefereePresenter extends IBasePresenter<ContentRefereeService>{
    private ContentRefereeView contentRefereeView;
    private ContentRefereeService contentRefereeService;
    public ContentRefereePresenter(ContentRefereeView view) {
        contentRefereeView=view;
        contentRefereeService=new ContentRefereeImpl();
        setService(contentRefereeService);
    }

    public void requestContentReferee(String userId){
        Map map=new HashMap();
        if(!TextUtils.isEmpty(userId)){
            map.put("user_id",userId);
        }
        contentRefereeService.requestContribution(YMServerUtil.ACTION_CONTENT_REFEREE, map, new ICallBack() {
            @Override
            public void onSuccess(int statusCode, Object result) {
                LogUtil.e("yzq",result.toString());
                contentRefereeView.getContent(result.toString());
            }

            @Override
            public void onFail(int statusCode, Object result) {
                LogUtil.e("yzq",result.toString());
                contentRefereeView.getContent(result.toString());
            }
        });
    }
}
